from dataclasses import asdict, dataclass, field
from typing import Any, Literal, Optional
@dataclass
class DataArguments:
    r"""Arguments pertaining to what data we are going to input our model for training and evaluation."""

    template: Optional[str] = field(
        default=None,
        metadata={"help": "Which template to use for constructing prompts in training and inference."},
    )
    dataset: Optional[str] = field(
        default=None,
        metadata={"help": "The name of dataset(s) to use for training. Use commas to separate multiple datasets."},
    )
    eval_dataset: Optional[str] = field(
        default=None,
        metadata={"help": "The name of dataset(s) to use for evaluation. Use commas to separate multiple datasets."},
    )
    dataset_dir: str = field(
        default="data",
        metadata={"help": "Path to the folder containing the datasets."},
    )
    media_dir: Optional[str] = field(
        default=None,
        metadata={"help": "Path to the folder containing the images, videos or audios. Defaults to `dataset_dir`."},
    )
    cutoff_len: int = field(
        default=2048,
        metadata={"help": "The cutoff length of the tokenized inputs in the dataset."},
    )

a = DataArguments()
# 初始化对象之后,规划了该对象的部分属性
print(a)
# 初始化对象之后,可以通过属性名访问属性值,该值可以是默认设定的值.
print(a.dataset_dir)
# 初始化对象之后,可以通过asdict函数将对象转换为字典,该字典的键为属性名,值为属性值.
print(asdict(a))
